package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface OrderMapper extends BaseMapper<Order> {
    @Select("select * from t_order where MEMBER_ID = #{mid} and SETMEAL_ID = #{setmealId} and ORDERDATE = #{orderDate}")
    Order selectByMemberAndDate(@Param("mid") Integer mid, @Param("setmealId") Integer setmealId, @Param("orderDate") String orderDate);

    @Select("select tm.name as member,ts.name as setmeal,tor.orderDate,tor.orderType from t_member" +
            " tm, t_setmeal ts, t_order tor where tm.id = tor.MEMBER_ID and ts.id = tor.SETMEAL_ID " +
            "and tor.id = #{id}")
    Map successOrder(@Param("id") int id);
}
